#!/bin/bash

DIR=outfiles

mkdir $DIR

#cut fields
cut -f1 $1 >$DIR/1.txt
cut -f2 $1 >$DIR/2.txt
cut -f3 $1 >$DIR/3.txt
cut -f4 $1 >$DIR/4.txt
cut -f5 $1 >$DIR/5.txt
cut -f6 $1 >$DIR/6.txt

#put together problöemgroesse and measurement
paste $DIR/1.txt $DIR/2.txt >$DIR/naiv.h.plot.txt
paste $DIR/1.txt $DIR/3.txt >$DIR/ddot.h.plot.txt
paste $DIR/1.txt $DIR/4.txt >$DIR/daxpy.h.plot.txt
paste $DIR/1.txt $DIR/5.txt >$DIR/dgemv.h.plot.txt
paste $DIR/1.txt $DIR/6.txt >$DIR/dgemm.h.plot.txt

#get rid of first line
tail --lines=+2 outfiles/naiv.h.plot.txt >outfiles/naiv.w.plot.txt
tail --lines=+2 outfiles/ddot.h.plot.txt >outfiles/ddot.w.plot.txt
tail --lines=+2 outfiles/daxpy.h.plot.txt >outfiles/daxpy.w.plot.txt
tail --lines=+2 outfiles/dgemv.h.plot.txt >outfiles/dgemv.w.plot.txt
tail --lines=+2 outfiles/dgemm.h.plot.txt >outfiles/dgemm.w.plot.txt
